package org.lanqiao.oa.visitor.impl;

import org.lanqiao.oa.dao.PermissionDao;
import org.lanqiao.oa.dto.PermissionDTO;
import org.lanqiao.oa.visitor.PermissionVisitor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;



@Repository
public class DeletePermissionVisitor extends AbstractVisitorClass implements PermissionVisitor {

    @Autowired
    private PermissionDao permissionDao;

    @Override
    PermissionDao permissionDao() {
        return permissionDao;
    }


    public DeletePermissionVisitor(PermissionDao permissionDao) {
        this.permissionDao = permissionDao;
    }

    /**
     * 删除权限的方法
     * @param permissionDto
     */
    @Override
    public void visit(PermissionDTO permissionDto) {
        //如果权限没有被使用则删除权限
        permissionDao.deletePermissionById(permissionDto.getId());

    }



}
